<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no" />
	<title>阳光牌友</title>  
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="x5-orientation" content="portrait">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Access-Control-Allow-Origin" content="">
	<meta http-equiv="content-security-policy">
	<script type="text/javascript" src="js/jquery.min.js" ></script>
	<!--mui样式-->
	<link rel="stylesheet" type="text/css" href="css/mui.min.css"/>
	<link rel="stylesheet" type="text/css" href="css/mui/app.css"/>
	<link rel="stylesheet" type="text/css" href="css/mui/mui.picker.css"/>
	<link rel="stylesheet" type="text/css" href="css/mui/mui.picker.min.css"/>
	<link rel="stylesheet" type="text/css" href="css/mui/mui.poppicker.css"/>
	<!--环信-->
	<script type="text/javascript" src="js/hx/strophe.js" ></script>
	<script type="text/javascript" src="js/hx/websdk-1.1.2.js"></script>
	<script type="text/javascript" src="js/hx/websdk.config.js"></script>
	<script type="text/javascript" src="js/hx/websdk.shim.js"></script> 
	<script type="text/javascript" src="js/bq.js"></script> 
	<!--环信-->
	<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=yWnFso0oyjmX79HzCx1DRz2sBtvweQfI"></script>
	<link rel="stylesheet" href="css/loding/fakeLoader.css"/>
	<!--头像上传-->
	<link rel="stylesheet" href="css/cropper.css"/>
	<script src="js/cropper.js"></script>
	<!-- 公共样式与字体  -->
	<link rel="stylesheet" href="css/public.css"/>
	<link rel="stylesheet" type="text/css" href="icon-font/iconfont.css"/>
	<!-- 定制样式   -->
	<link rel="stylesheet" href="css/style.css"/>
	<link rel="stylesheet" href="css/bq.css" />
	<link rel="stylesheet" type="text/css" href="css/NewStyle.css"/>
	<!-- Swiper 样式  -->
	<link rel="stylesheet" type="text/css" href="css/swiper.min.css"/>
	<link rel="stylesheet" href="css/appstyle.css" />
	<style type="text/css">
		.rgba{display: none;}
	</style>
</head>
<body>
	<div class="App">
		<span>阳光牌友</span>
		<button>下载APP</button>
	</div>
	<div class="mui-navbar-inner mui-bar mui-bar-nav pHead header_1 ProductPageHead">
		<h2>产品名称</h2>
	</div>
	<main class="mui-page-content pBody ProductPageMain">
		<div class="ProductImg">
			<i class="Img"></i>
		</div>
		<div class="ProductName">
			<p>麻将机</p>
			<p>签到1000次就是你的了</p>
			<button class="SignBtn SignBtn2">帮签到</button>
		</div>
		<div class="ProductDetail">
			<p class="ProductDetailTitle">商品信息</p>
			<pre class="Content"></pre>
		</div>
		<!--<div class="ProductFooter">-->
			<!--<img src="images/footer-banner.jpg" alt="" />-->
		<!--</div>-->
	</main>
	<div class="" id="tan2"></div>
	<script src="js/base.js"></script>
	<script type="text/javascript">
		var url = 'http://www.yuzhuli.com/api.php/Api/prizes_detail';
		var qurl = 'http://www.yuzhuli.com/api.php/Api/prizes_sign_in';
		
		$('.App button').unbind('click').on('click',function(){
			location.href = 'http://www.yuzhuli.com/';
		});
		
		function getCache(key){
			if(localStorage.getItem(key)){
				return JSON.parse(localStorage.getItem(key));
			}else{
				return false;
			}
		}
		function GetQueryString(name){
		     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		     var r = window.location.search.substr(1).match(reg);
		     if(r!=null)return  unescape(r[2]); return null;
		}
		var to = GetQueryString('token');
		var to2 = GetQueryString('id');
		var Token = getCache('token');
//		if(!Token){
//			location.href = 'index.html';
//		}
		var id2 = GetQueryString('id');
		$.post(url,{id:id2,token:Token},function(obj){
			if(obj.s){
//				if(obj.d.ad){
//					$('.ProductFooter img').attr({'src':obj.d.ad.img,'link':obj.d.ad.link});
//				}else{
//					$('.ProductFooter').hide();
//				}
				$('.ProductPageHead h2').text(obj.d.info.title);
				$('.ProductImg i.Img').css('background-image','url('+obj.d.info.img+')');						
				$('pre.Content').html(obj.d.info.content);
				$('.ProductName').attr('type',obj.d.info.id);
				$('.ProductName p').eq(0).text(obj.d.info.title)
				$('.ProductName p').eq(1).text('签到'+obj.d.info.sign_in_num+'次就是你的了');
			}else{
				tan('网络异常');
			}
		});
		
		$('.SignBtn2').unbind('click').on('click',function(){
			var token = getCache('token');
			console.log(token)
			if(token){
				$.post(qurl,{type:2,id:id2,token:Token,user_id:to},function(obj){
					if(obj.s){
						tan("帮签到成功");
						$('.SignBtn2').css({'background-color':'#eee','color':'#333'}).text('签到成功');
					}else{
						tan(obj.m)
					}
				})
			}else{
				location.href = 'index.html?id='+to2+'&token='+to;
			}
		});
		
		function tan(text2){
			$("#tan2").addClass("tan");
			$("#tan2").text(text2);
			clearTimeout(a);
			var a = setTimeout (function(){
				ding();
			},2000);
			function ding (){
				$("#tan2").removeClass("tan");
				$("#tan2").text("");
			};
		}
		var hhh = $(window).height() - $('.ProductImg').height() - $('.ProductName').height() - $('.header_1').height();
		$('.ProductDetail').height(hhh);
		
		$('.ProductDetail pre.Content').height(hhh - 120);
	</script>
</body>
</html>
